<%--
  Created by IntelliJ IDEA.
  User: 辰
  Date: 2023/12/13
  Time: 14:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>分页展示</title>
</head>
<body>
<table border="1">
    <tr>
        <th>商品名称</th>
        <th>商品价格</th>
    </tr>
    <c:forEach items="${allGoods }" var="goods">
        <tr>
            <td>${goods.gname }</td>
            <td>${goods.gprice }</td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="3" align="right">
            &nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;共${totalCount}条记录&nbsp;&nbsp;共${totalPage}页&nbsp;&nbsp;
            第${pageCur}页&nbsp;&nbsp;
        <c:url var="url_pre" value="selectGoodsByPageServlet">
            <c:param name="pageCur" value="${pageCur-1}"></c:param>
        </c:url>
        <c:url var="url_next" value="selectGoodsByPageServlet">
            <c:param name="pageCur" value="${pageCur+1}"></c:param>
        </c:url>
        <c:if test="${pageCur!=1}">
            <a href="${url_pre}">上一页</a>
        </c:if>
        <c:if test="${pageCur != totalPage && totalPage!=0}">
            <a href="${url_next}">下一页</a>
        </c:if>
        </td>
    </tr>
</table>
</body>
</html>
